package com.woniuxy.web;

import com.woniuxy.config.ResponseResult;
import com.woniuxy.entity.Comments;
import com.woniuxy.entity.CommentsVO;

import com.woniuxy.service.CommentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("comments")

public class CommentsController {
    @Autowired
    private CommentsService commentsService;
    @PostMapping("add")
    public ResponseResult<Void> add(@RequestBody CommentsVO commentsVO){
        commentsService.add(commentsVO);
        return ResponseResult.SUCCUESS;
    }
    @GetMapping("list")
    public ResponseResult<List<Comments>> getByCinemaComments(Integer cinemaid){
       List<Comments> list= commentsService.getByCinemaComments(cinemaid);

        return new ResponseResult<>(list);
    }
}
